package com.eat.fish_service.controller.web;


import com.eat.common_utils.R;
import com.eat.fish_service.service.SensorDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author CZF
 * @since 2022-04-11
 */


@RestController("webSensorDataController")
@RequestMapping("/web/sensor-data")
@CrossOrigin
@Api(tags = "web端水质信息")
public class SensorDataController {

    @Autowired
    SensorDataService sensorDataService;

    /**
     * 获取某一天的ph
     */
    @ApiOperation(value = "获取某一天的ph")
    @GetMapping("getPh/{aquariumId}/{time}")
    public R getPh(@PathVariable("aquariumId")Long aquariumId,@PathVariable("time") Long time){
        return sensorDataService.getPh(aquariumId, time);
    }

    /**
     * 获取某一天的温度
     */
    @ApiOperation(value = "获取某一天的温度")
    @GetMapping("getTem/{aquariumId}/{time}")
    public R getTem(@PathVariable("aquariumId")Long aquariumId,@PathVariable("time") Long time){
        return sensorDataService.getTem(aquariumId,time);
    }


    /**
     * 获取某一天的电导率
     */
    @ApiOperation(value = "获取某一天的电导率")
    @GetMapping("getDianDao/{aquariumId}/{time}")
    public R getDianDao(@PathVariable("aquariumId")Long aquariumId,@PathVariable("time") Long time){
        return sensorDataService.getDianDao(aquariumId,time);
    }

    /**
     * 获取某一天的浑浊度
     */
    @ApiOperation(value = "获取某一天的浑浊度")
    @GetMapping("getHunZhuo/{aquariumId}/{time}")
    public R getHunZhuo(@PathVariable("aquariumId")Long aquariumId,@PathVariable("time") Long time){
        return sensorDataService.getHunZhuo(aquariumId,time);
    }

    /**
     * 获取某一天的溶解氧
     */
    @ApiOperation(value = "获取某一天的溶解氧")
    @GetMapping("getRongJieYang/{aquariumId}/{time}")
    public R getRongJieYang(@PathVariable("aquariumId")Long aquariumId,@PathVariable("time") Long time){
        return sensorDataService.getRongJieYang(aquariumId,time);
    }
}

